import { createBrowserRouter } from "react-router-dom";
import React from "react";
import QuetionLayout from "../pages/question/Layout/index.tsx";
import ManageLayout from "../pages/manage/Layout/index.tsx";
import MainLayout from "../pages/MainLayout/index.tsx";
import Layout from "../pages/Layout/Layout.tsx";
import List from "../pages/manage/List/index.tsx";
import Star from "../pages/manage/Star/index.tsx";
import Trash from "../pages/manage/Trash/index.tsx";
import Edit from "../pages/question/Edit/index.tsx";
import Register from "../pages/Register/index.tsx";
import Login from "../pages/Login/index.tsx";
import NoFound from "../pages/NoFound/index.tsx";
import Stat from "../pages/question/Stat/index.tsx";
// import QuetionLayout from "../pages/question/Layout/QuetionLayout.tsx";
const router = createBrowserRouter([
  {
    path: "/",
    element: <MainLayout />,
    children: [
      {
        path: "/",
        element: <Layout />,
      },
      {
        path: "login",
        element: <Login />,
      },
      {
        path: "register",
        element: <Register />,
      },
      {
        path: "manage",
        element: <ManageLayout></ManageLayout>,
        children: [
          {
            path: "list/",
            element: <List></List>,
          },
          {
            path: "star",
            element: <Star></Star>,
          },
          {
            path: "Trash",
            element: <Trash></Trash>,
          },
        ],
      },
      {
        path: "edit",
        element: <Edit></Edit>,
      },
      {
        path: "*",
        element: <NoFound />,
      },
    ],
  },
  {
    path: "/question",
    element: <QuetionLayout></QuetionLayout>,
    children: [
      {
        path: "edit/:id",
        element: <Edit></Edit>,
      },
      {
        path: "Stat/:id",
        element: <Stat></Stat>,
      },
    ],
  },
]);

export default router;

// 定义常用的路由常量
export const HOME_PAGE = "/";
export const LOGIN_PAGE = "/login";
export const MANAGE_QUESTIONLIST = "/manage/list";
